﻿using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Geometry;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CADTool.Jig
{
    public class BlockReferenceJig:EntityJig
    {
        public  Point3d _position;
        public BlockReferenceJig(Entity entity):base(entity)
        {

        }
        public Entity GetEntity()
        {
            return Entity;
        }
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            JigPromptPointOptions options= new JigPromptPointOptions("\n请指定插入点");
            PromptPointResult result=prompts.AcquirePoint(options);
            if (result.Status==PromptStatus.OK)
            {
                _position = result.Value;
                return SamplerStatus.OK;
            }
            else
            {
                return SamplerStatus.Cancel;
            }
        }

        protected override bool Update()
        {
           ((BlockReference)Entity).Position= _position;    
            return true;
        }
    }
}
